﻿<%@ include file="../include/top.jsp" %>
<%@ include file="../include/errorArea.jsp" %>

<form name="myForm" method="POST" action="${baseURL}/supplierAdmin/addUser" onsubmit="joinAclStr()">
<input type="hidden" name="supplierId" value="${formdata.supplierId}" />
<input type="hidden" name="id" value="${formdata.id}" />
<input type="hidden" name="aclStr" id="aclStr"/>
<TABLE width='95%' class='table-border' cellpadding=0 cellspacing=0>
	<tr>
	    <td height="21" class='tr-title'>&nbsp;&nbsp;
		<c:if test="${empty formdata.id || formdata.id==0}">
		添加用户
		</c:if> 
		<c:if test="${not empty formdata.id && formdata.id>0}">
		编辑用户
		</c:if>
		</td>
	</tr>
	<tr>
		<TD width='100%'>
			<TABLE width='100%' border=0 cellpadding=2 cellspacing=2 id="content-input">
				<tr>
					<td width='150' align='right'>供货商ID：</td>
					<td align="left">${formdata.supplierId}</td>
				</tr>
			    <tr>
					<td width='150' align='right'><span class="mustInput">*</span>用户名：</td>
					<td align="left"><input name="username" type="text" id="username"
						value="${formdata.username}" size="25" maxlength="50" class="myInput"/></td>
				</tr>
				<tr>
					<td width='150' align='right'><span class="mustInput">*</span>密码 ：</td>
					<td align="left"><input name="pw" type="password" id="password"
						value="${formdata.pw}" size="70" maxlength="50" class="myInput"/></td>
			    </tr>
			    <tr>
					<td width='150' align='right'>备注：</td>
					<td align="left"><input name="remark" type="text" id="remark"
						value="${formdata.remark}" size="70" maxlength="30" class="myInput"/></td>
				</tr>
				<tr>
					<td width='150' align='right'>权限：</td>
					<td align="left">
					<c:forEach var="name" items="${supplierAclNameArrayUser}" varStatus="status">
						<label><input type="checkbox" name="acl" <c:if test="${supplierAclArrayUser[status.index]=='1'}">checked</c:if>/>${name}</label>
					</c:forEach>
					</td>
				</tr>
				<TR>
					<td height="65" align="center" colspan=2>
						<table width="200" border="0" cellspacing="0" cellpadding="0">
							<tr>
							  <td valign="middle">
							  	<input name="submit" type="submit" value="提交" class="btnstyle" />
							  </td>
							  <td align="center" valign="middle" >&nbsp;</td>
							  <td valign="middle" >
							  	<input name="button" type="button" onclick="history.go(-1)" value="返回" class="btnstyle"/>
							  </td>
							</tr>
						</table>
					</td>
				</TR>
				<tr>
				  <td colspan="4" align="center">&nbsp;</td>
			    </tr>
			</TABLE>
		</TD>
	</tr>
</TABLE>
</form>

<%-- <table width="98%" border="0" align="center" cellpadding="0" cellspacing="1" style="margin-top:10px;">
<tr>
  <td colspan="2" align="left" valign="middle" class="text_gray2">
  
<table width="100%" border="0" align="center" cellpadding="0" cellspacing="1" bgcolor="#96bee2" class='table-border'>
<tr>
  <td height="21" class='tr-title'>&nbsp;&nbsp;
<c:if test="${empty formdata.id || formdata.id==0}">
添加用户
</c:if> 
<c:if test="${not empty formdata.id && formdata.id>0}">
编辑用户
</c:if>
</td>
</tr>
<tr>
  <td height="13" align="center" valign="top" bgcolor="#FFFFFF">
<form name="myForm" method="POST" action="${baseURL}/supplierAdmin/addUser" onsubmit="joinAclStr()">
<input type="hidden" name="supplierId" value="${formdata.supplierId}" />
<input type="hidden" name="id" value="${formdata.id}" />
<input type="hidden" name="aclStr" id="aclStr"/>
<table width="100%" border="0" align="center" id="listTable" bgcolor="#FFFFFF" cellpadding="1" cellspacing="0">
	<tr style="display:none">
	  <td colspan="2" height="0" >
	  </td>
    </tr>
    <tr>
		<td align="right">供货商ID：</td>
		<td align="left">${formdata.supplierId}</td>
	</tr>
    <tr>
		<td align="right"><span class="mustInput">*</span>用户名：</td>
		<td align="left"><input name="username" type="text" id="username"
			value="${formdata.username}" size="25" maxlength="50" class="myInput"/></td>
	</tr>
	<tr>
		<td align="right"><span class="mustInput">*</span>密码 ：</td>
		<td align="left"><input name="pw" type="password" id="password"
			value="${formdata.pw}" size="70" maxlength="50" class="myInput"/></td>
    </tr>
    <tr>
		<td align="right">备注：</td>
		<td align="left"><input name="remark" type="text" id="remark"
			value="${formdata.remark}" size="70" maxlength="30" class="myInput"/></td>
	</tr>
	<tr>
		<td align="right">权限：</td>
		<td align="left">
		<c:forEach var="name" items="${sessionScope.supplierAclNameArray}" varStatus="status">
			<label><input type="checkbox" name="acl" <c:if test="${sessionScope.supplierAclArray[status.index]=='1'}">checked</c:if>/>${name}</label>
		</c:forEach>
		</td>
	</tr>
	<TR>
		<td height="65" align="center" colspan=2>
			<table width="200" border="0" cellspacing="0" cellpadding="0">
				<tr>
				  <td valign="middle">
				  	<input name="submit" type="submit" value="提交" class="myButton" />
				  </td>
				  <td align="center" valign="middle" >&nbsp;</td>
				  <td valign="middle" >
				  	<input name="button" type="button" onclick="history.go(-1)" value="返回" class="myButton"/>
				  </td>
				</tr>
			</table>
		</td>
	</TR>
	<tr>
	  <td colspan="4" align="center">&nbsp;</td>
    </tr>
</table>
</form></td>
      </tr>
  </table></td>
</tr>
</table> --%>
<script>
//拼接权限字符串
function joinAclStr(checkAllFlag) {
	var str="";
	var checkArray = document.getElementsByName("acl");
	for (var i = 0; i < checkArray.length; i++) {
		str += checkArray[i].checked?"1":"0";
	}
	$("#aclStr").val(str);
}
</script>
<%@ include file="../include/bottom.jsp" %>